home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / filesyst / ncpfs / mars_dos.000 / mars_dos / netpc / kern.asm < prev    next >
Encoding:
Assembly Source File  |  1996-01-12  |  3.6 KB  |  202 lines

  1. ; kern.asm: 20-Nov-93, 21:52
  2. IDEAL
  3. P286
  4. MODEL LARGE
  5. ; Fuer Turboc gerettet werden muessen folgende Register:
  6. ; BP, SS, SP, DS, CS u. SI, DI
  7.  
  8. MACRO P_START
  9.    push    bp
  10.    mov     bp, sp
  11. ENDM
  12.  
  13. MACRO P_END
  14.    pop     bp
  15. ENDM
  16.  
  17. MACRO PUSH_REGS
  18.    push    ds
  19.    push    si
  20.    push    di
  21. ENDM
  22.  
  23. MACRO POP_REGS
  24.    pop     di
  25.    pop     si
  26.    pop     ds
  27. ENDM
  28.  
  29. ;; EXTRN   _esr_routine:FAR
  30.  
  31. PUBLIC  _IPXinit;
  32. PUBLIC  _IPXopen_socket;
  33. PUBLIC  _IPXclose_socket;
  34. PUBLIC  _IPXlisten;
  35. ;; PUBLIC  _asm_esr_routine;
  36. PUBLIC  _xmemmove;
  37. PUBLIC  _Net_Call;
  38.  
  39. DATASEG
  40. enterIPX  DD FAR
  41.  
  42. CODESEG
  43. PROC _IPXinit;
  44.    P_START
  45.    PUSH_REGS
  46.    mov     ax,  7A00h
  47.    int     2Fh
  48.    cmp     al,  0FFh
  49.    jne     @@fertig
  50.    mov     cx, @data
  51.    mov     ds, cx
  52.    mov     [WORD PTR enterIPX],   di
  53.    mov     ax, es
  54.    mov     [WORD PTR enterIPX+2], ax
  55.    mov     al, 1 ; OK
  56. @@fertig:
  57.    mov    ah, 0
  58.    POP_REGS
  59.    P_END
  60.    ret         ;  OK = 1 ; nicht ok = 0
  61. ENDP
  62.  
  63. PROC  _xmemmove;
  64.       ARG     z:DATAPTR, q:DATAPTR, nmbr:WORD; Argumente
  65.       cli             ; Disable Interrupts
  66.       push    bp
  67.       mov     bp,sp
  68.       mov     cx, [nmbr];
  69.       or      cx, cx;
  70.       jz      @@fertig; Anzahl ist 0;
  71.       push    ds;
  72.       push    si;
  73.       push    di;
  74.       pushf
  75.       lds     si, [q] ; Quelle
  76.       les     di, [z] ; Ziel
  77.       cmp     di, si  ;
  78.       jl      @@L1    ; Ziel ist kleiner
  79.       std             ; Richtungsflag setzen
  80.       dec     cx
  81.       add     di, cx  ; Von oben nach unten kopieren
  82.       add     si, cx  ;
  83.       inc     cx      ; alten Wert wiederherstellen
  84.       jmp     @@L2;
  85.       @@L1:
  86.       cld             ; Richtungsflag loeschen
  87.       @@L2:           ; und nun das eigentliche kopieren
  88.       REP     movsb   ;
  89.       popf
  90.       pop     di;
  91.       pop     si;
  92.       pop     ds;
  93.       @@fertig:
  94.       pop     bp;
  95.       sti             ; enable Interrupts
  96.       ret
  97. ENDP
  98.  
  99. PROC  _IPXopen_socket;
  100.       ARG  sock:WORD, live:WORD
  101.       P_START
  102.       PUSH_REGS
  103.       mov     ax, [live]
  104.       mov     dx, [sock]
  105.       mov     bx, @data
  106.       mov     ds, bx
  107.       mov     bx, 0
  108.       call    [enterIPX]
  109.       cmp     al,  0FFh
  110.       jne     @@L1
  111.       mov     ax, -1 ; Socket already open
  112.       jmp     @@L3
  113. @@L1:
  114.       cmp     al,  0FEh
  115.       jne     @@L2
  116.       mov     ax, -2 ; Socket Table full
  117.       jmp     @@L3
  118. @@L2:
  119.       mov     ax, dx
  120. @@L3:
  121.       POP_REGS
  122.       P_END
  123.       ret
  124. ENDP
  125.  
  126. PROC  _IPXclose_socket;
  127.       ARG  sock:WORD
  128.       P_START
  129.       PUSH_REGS
  130.       mov     dx, [sock]
  131.       mov     bx, @data
  132.       mov     ds, bx
  133.       mov     bx, 1
  134.       call    [enterIPX]
  135.       POP_REGS
  136.       P_END
  137.       ret
  138. ENDP
  139.  
  140. PROC  _IPXlisten;
  141.       ARG  ecb:DATAPTR
  142.       P_START
  143.       PUSH_REGS
  144.       les     si, [ecb] ; Adresse ecb
  145.       mov     bx, @data
  146.       mov     ds, bx
  147.       mov     bx, 4
  148.       call    [enterIPX]
  149.       POP_REGS
  150.       P_END
  151.       mov  ah, 0
  152.       ret
  153. ENDP
  154.  
  155. ;; PROC  _asm_esr_routine;
  156. ;;       push    bp;
  157. ;;       PUSH_REGS;
  158. ;;       mov     ax, @data
  159. ;;       mov     ds, ax     ;  Für C PROGRAMM
  160. ;;       push    es; Adressegment vom EBC
  161. ;;       push    si; Adressoffset vom ECB
  162. ;;       call    _esr_routine;  C ROUTINE
  163. ;;       pop     si;
  164. ;;       pop     es;
  165. ;;       POP_REGS;
  166. ;;       pop     bp;
  167. ;;       cli   ; no Interrupt says NOVELL
  168. ;;       ret
  169. ;; ENDP
  170.  
  171.  
  172. PROC  _Net_Call;
  173.       ARG     func:WORD, req:DATAPTR, repl:DATAPTR; Argumente
  174.       push    bp
  175.       mov     bp, sp
  176.       mov     ax, [func];
  177.       push    ds;
  178.       push    si;
  179.       push    di;
  180.       pushf
  181.       lds     si, [req]  ; Request
  182.       les     di, [repl] ; Reply
  183.       int     21h
  184.       popf
  185.       pop     di;
  186.       pop     si;
  187.       pop     ds;
  188.       pop     bp;
  189.       mov     ah, 0
  190.       ret
  191. ENDP
  192.  
  193. END
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.